---
title: clsPrint
summary: API reference for clsPrint.
status: draft
owner: SAIF Case Management
last_reviewed: 2026-08-21
library: SAIF.Services.Printing
reference_type: embedded
---

# clsPrint

`clsPrint` is the stateful facade over the external xPression Design "xPresso" document-generation SOAP service (`xpresso.clsGenerate`). It is instantiated directly by the `Legal` ASP.NET WebForms front end (`clsLegalAncestor`, `clsLegalModel`, `frmPrintPreview.aspx.vb`) and internally by `Reporting.ReportBase`, and owns both the synchronous SOAP preview/print/distribute path and an asynchronous MSMQ distribution path (queueing a `CompositeRequestClass` snapshot at `documentMSMQPath` under an optional MSMQ transaction).

## Purpose
- Provide a single call surface for previewing, printing, publishing, and distributing xPression-generated documents so callers do not interact with the generated SOAP proxy directly.
- Route distribution requests either synchronously (direct SOAP call) or asynchronously (MSMQ queue), including MSMQ transaction lifecycle management.
- Resolve its xPression endpoint URL, MSMQ queue path, and IDM file path from `EnvironmentServiceBase.GetConfigSetting`, and its production/dev flag from `EnvironmentServiceBase.IsProduction`.

## Context
- Namespace: `SAIF.Services.Printing`
- Assembly/package: `SAIF.Services.Printing` (embedded, front-end referenced)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `New()` | `Public Sub New()` | Parameterless constructor; delegates to the environment-service-accepting overload using `AppGlobal.EnvironmentService`.* |
| `New(envSvc)` | `Public Sub New(envSvc As EnvironmentServiceBase)` | Stores the supplied environment service, reads `documentGeneratorServiceUrl`, `documentMSMQPath`, and `IsProduction` to initialize the SOAP proxy URL, MSMQ path, and environment flag. |
| `Package` | `Public Property Package As String` | The xPression document/package name to preview, print, or distribute. |
| `XML` | `Public Property XML As String` | The XML content submitted to the xPression Design service for rendering. |
| `IDMPath` | `Public ReadOnly Property IDMPath As String` | Returns the `idmFilePath` configuration value, re-queried from the environment service on every access (not cached). |
| `Asynchronous` | `Public Property Asynchronous As Boolean` | When `True`, `distributeDocument` routes through the MSMQ queue instead of a direct SOAP call. |
| `previewDocument(package, xml)` | `Public Function previewDocument(package As String, xml As String) As Byte()` | Sets `Package`/`XML` and renders the document to PDF bytes via the xPression SOAP service; see [Preview a document via xPression](../../operations/preview-document-xpresso.md). |
| `previewPDF()` | `Public Function previewPDF() As Byte()` | Same rendering path as `previewDocument`, forcing `Application = "xPression Design"`; see [Preview a document via xPression](../../operations/preview-document-xpresso.md). |
| `printPDF(inFile)` | `Public Function printPDF(inFile As Byte()) As Boolean` | Sends rendered PDF bytes to the configured printer via the xPression SOAP service; always returns `True` regardless of the SOAP result; see [Print raw PDF bytes](../../operations/print-pdf.md). |
| `distributeDocument(package, xml)` | `Public Function distributeDocument(package As String, xml As String) As Boolean` | Delivers the document synchronously (direct SOAP call) or asynchronously (MSMQ queue) depending on `Asynchronous`; see [Distribute a document](../../operations/distribute-document.md). |
| `StartMQTransaction()` | `Public Sub StartMQTransaction()` | Begins (or reuses) an MSMQ transaction so multiple queued sends can be batched; see [MSMQ transaction lifecycle](../../operations/msmq-transaction-lifecycle.md). |
| `EndMQTransaction(inAction)` | `Public Sub EndMQTransaction(inAction As Boolean)` | Commits (`True`) or aborts (`False`) the active MSMQ transaction and always disposes it; see [MSMQ transaction lifecycle](../../operations/msmq-transaction-lifecycle.md). |
| `xpublishDocument`, `xpreviewHTML`, `xpublishAndReturnDocument`, `xdocumentsForCategory`, `xoutputProfilesForDocument`, `xcategoriesForUser` | (various) | Direct 1:1 passthrough methods to the corresponding `m_Xpresso` SOAP proxy methods for xDashBoard integration; see [xDashBoard passthrough operations](../../operations/xdashboard-passthrough.md). |
| `ImportInfo` | `Public Property ImportInfo As clsImageImport` | Holds imaging-import metadata (from `SAIF.Services.Imaging.Import`) serialized into the MSMQ payload and the synchronous `distributeDocument` SOAP call. |
| `CompositeRequestClass` (nested) | `<Serializable()> Public Class CompositeRequestClass` | Message payload shape queued to MSMQ for asynchronous document distribution; snapshots all relevant `clsPrint` property values at the time of the call. |
| `IDMEnvs` (nested enum) | `Public Enum IDMEnvs` | Enumerates IDM (imaging) environment names (`Dev`, `Test`, `QA`, `Prod`, `NonImaged`); declared but not read or assigned anywhere in scanned code.** |

## Behavioral notes
- `printPDF` returns `True` unconditionally; the underlying SOAP call's actual outcome is not inspected, so print failures may not surface to the caller.*
- The asynchronous distribution path rolls back its MSMQ transaction and re-throws on any exception, while the synchronous path forwards SOAP faults directly to the caller.*
- `IDMEnvs` has no confirmed use in the scanned code beyond its declaration.**

## Constraints and usage notes
- The default constructor obtains its `EnvironmentServiceBase` from `AppGlobal.EnvironmentService`, enabling test/DI substitution via the explicit constructor overload.*
- No business-rule validation occurs in this class; all conditional logic controls delivery mechanism (sync vs. async) rather than domain-policy enforcement.

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- `SAIF.Services.Printing\clsPrint.vb`
